﻿using Model;
using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FubiManger.UI;

namespace FubiManger.Controls
{
    ////ToolboxItem用于控制是否添加自定义控件到工具箱，true添加，false不添加
    //[System.ComponentModel.ToolboxItem(true)]
    partial class Buycarcontrol : Smobiler.Core.Controls.MobileUserControl
    {

        public Buycarcontrol() : base()
        {
            //This call is required by the SmobilerUserControl.
            InitializeComponent();
        }
        /// <summary>
        /// 商品集合
        /// </summary>
        public List<Gdpro> gdpros { get; set; }

        private void Buycarcontrol_Load(object sender, EventArgs e)
        {
            this.Height = gdpros.Count * 60;
            pancar.Height = gdpros.Count * 60;
            for (int i = 0; i < gdpros.Count; i++)
            {
                Carproductcontrol con = new Carproductcontrol();
                con.proname = gdpros[i].proname;//商品名称
                con.proimg = gdpros[i].proimg;//商品图片
                con.price = gdpros[i].price;//价格
                con.count = gdpros[i].count;//数量
                con.proid = i;//编号
                pancar.Controls.Add(con);
            }
        }
        /// <summary>
        /// 删除商品
        /// </summary>
        /// <param name="proid"></param>
        public void Delpro(int proid)
        {
            this.Close();
            ((OrderfoodForm)this.Form).Delpro(proid);
        }
    }
}